//===----------------------------------------------------------------------===//
//
// This source file is part of the Soto for AWS open source project
//
// Copyright (c) 2017-2024 the Soto project authors
// Licensed under Apache License v2.0
//
// See LICENSE.txt for license information
// See CONTRIBUTORS.txt for the list of Soto project authors
//
// SPDX-License-Identifier: Apache-2.0
//
//===----------------------------------------------------------------------===//

// THIS FILE IS AUTOMATICALLY GENERATED by https://github.com/soto-project/soto-codegenerator.
// DO NOT EDIT.

#if canImport(FoundationEssentials)
import FoundationEssentials
#else
import Foundation
#endif
@_exported import SotoCore

/// Service object for interacting with AWS BedrockAgentRuntime service.
///
/// Contains APIs related to model invocation and querying of knowledge bases.
public struct BedrockAgentRuntime: AWSService {
    // MARK: Member variables

    /// Client used for communication with AWS
    public let client: AWSClient
    /// Service configuration
    public let config: AWSServiceConfig

    // MARK: Initialization

    /// Initialize the BedrockAgentRuntime client
    /// - parameters:
    ///     - client: AWSClient used to process requests
    ///     - region: Region of server you want to communicate with. This will override the partition parameter.
    ///     - partition: AWS partition where service resides, standard (.aws), china (.awscn), government (.awsusgov).
    ///     - endpoint: Custom endpoint URL to use instead of standard AWS servers
    ///     - middleware: Middleware chain used to edit requests before they are sent and responses before they are decoded 
    ///     - timeout: Timeout value for HTTP requests
    ///     - byteBufferAllocator: Allocator for ByteBuffers
    ///     - options: Service options
    public init(
        client: AWSClient,
        region: SotoCore.Region? = nil,
        partition: AWSPartition = .aws,
        endpoint: String? = nil,
        middleware: AWSMiddlewareProtocol? = nil,
        timeout: TimeAmount? = nil,
        byteBufferAllocator: ByteBufferAllocator = ByteBufferAllocator(),
        options: AWSServiceConfig.Options = []
    ) {
        self.client = client
        self.config = AWSServiceConfig(
            region: region,
            partition: region?.partition ?? partition,
            serviceName: "BedrockAgentRuntime",
            serviceIdentifier: "bedrock-agent-runtime",
            signingName: "bedrock",
            serviceProtocol: .restjson,
            apiVersion: "2023-07-26",
            endpoint: endpoint,
            errorType: BedrockAgentRuntimeErrorType.self,
            middleware: middleware,
            timeout: timeout,
            byteBufferAllocator: byteBufferAllocator,
            options: options
        )
    }





    // MARK: API Calls

    /// Creates a new invocation within a session. An invocation groups the related invocation steps that store the content from a conversation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. Related APIs    ListInvocations     ListSessions     GetSession
    @Sendable
    @inlinable
    public func createInvocation(_ input: CreateInvocationRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateInvocationResponse {
        try await self.client.execute(
            operation: "CreateInvocation", 
            path: "/sessions/{sessionIdentifier}/invocations/", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a new invocation within a session. An invocation groups the related invocation steps that store the content from a conversation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. Related APIs    ListInvocations     ListSessions     GetSession
    ///
    /// Parameters:
    ///   - description: A description for the interactions in the invocation. For example, "User asking about weather in Seattle".
    ///   - invocationId: A unique identifier for the invocation in UUID format.
    ///   - sessionIdentifier: The unique identifier for the associated session for the invocation. You can specify either the session's sessionId or its Amazon Resource Name (ARN).
    ///   - logger: Logger use during operation
    @inlinable
    public func createInvocation(
        description: String? = nil,
        invocationId: String? = nil,
        sessionIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateInvocationResponse {
        let input = CreateInvocationRequest(
            description: description, 
            invocationId: invocationId, 
            sessionIdentifier: sessionIdentifier
        )
        return try await self.createInvocation(input, logger: logger)
    }

    /// Creates a session to temporarily store conversations for generative AI (GenAI) applications built with open-source frameworks such as LangGraph and LlamaIndex. Sessions enable you to save the state of conversations at checkpoints, with the added security and infrastructure of Amazon Web Services. For more information, see Store and retrieve conversation history and context with Amazon Bedrock sessions. By default, Amazon Bedrock uses Amazon Web Services-managed keys for session encryption, including session metadata, or you can use your own KMS key. For more information, see Amazon Bedrock session encryption.   You use a session to store state and conversation history for generative AI applications built with open-source frameworks. For Amazon Bedrock Agents, the service automatically manages conversation context and associates them with the agent-specific sessionId you specify in the InvokeAgent API operation.   Related APIs:    ListSessions     GetSession     EndSession     DeleteSession
    @Sendable
    @inlinable
    public func createSession(_ input: CreateSessionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> CreateSessionResponse {
        try await self.client.execute(
            operation: "CreateSession", 
            path: "/sessions/", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Creates a session to temporarily store conversations for generative AI (GenAI) applications built with open-source frameworks such as LangGraph and LlamaIndex. Sessions enable you to save the state of conversations at checkpoints, with the added security and infrastructure of Amazon Web Services. For more information, see Store and retrieve conversation history and context with Amazon Bedrock sessions. By default, Amazon Bedrock uses Amazon Web Services-managed keys for session encryption, including session metadata, or you can use your own KMS key. For more information, see Amazon Bedrock session encryption.   You use a session to store state and conversation history for generative AI applications built with open-source frameworks. For Amazon Bedrock Agents, the service automatically manages conversation context and associates them with the agent-specific sessionId you specify in the InvokeAgent API operation.   Related APIs:    ListSessions     GetSession     EndSession     DeleteSession
    ///
    /// Parameters:
    ///   - encryptionKeyArn: The Amazon Resource Name (ARN) of the KMS key to use to encrypt the session data. The user or role creating the session must have permission to use the key. For more information, see Amazon Bedrock session encryption.
    ///   - sessionMetadata: A map of key-value pairs containing attributes to be persisted across the session. For example, the user's ID, their language preference, and the type of device they are using.
    ///   - tags: Specify the key-value pairs for the tags that you want to attach to the session.
    ///   - logger: Logger use during operation
    @inlinable
    public func createSession(
        encryptionKeyArn: String? = nil,
        sessionMetadata: [String: String]? = nil,
        tags: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> CreateSessionResponse {
        let input = CreateSessionRequest(
            encryptionKeyArn: encryptionKeyArn, 
            sessionMetadata: sessionMetadata, 
            tags: tags
        )
        return try await self.createSession(input, logger: logger)
    }

    /// Deletes memory from the specified memory identifier.
    @Sendable
    @inlinable
    public func deleteAgentMemory(_ input: DeleteAgentMemoryRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteAgentMemoryResponse {
        try await self.client.execute(
            operation: "DeleteAgentMemory", 
            path: "/agents/{agentId}/agentAliases/{agentAliasId}/memories", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes memory from the specified memory identifier.
    ///
    /// Parameters:
    ///   - agentAliasId: The unique identifier of an alias of an agent.
    ///   - agentId: The unique identifier of the agent to which the alias belongs.
    ///   - memoryId: The unique identifier of the memory.
    ///   - sessionId: The unique session identifier of the memory.
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteAgentMemory(
        agentAliasId: String,
        agentId: String,
        memoryId: String? = nil,
        sessionId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteAgentMemoryResponse {
        let input = DeleteAgentMemoryRequest(
            agentAliasId: agentAliasId, 
            agentId: agentId, 
            memoryId: memoryId, 
            sessionId: sessionId
        )
        return try await self.deleteAgentMemory(input, logger: logger)
    }

    /// Deletes a session that you ended. You can't delete a session with an ACTIVE status. To delete an active session, you must first end it with the EndSession API operation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    @Sendable
    @inlinable
    public func deleteSession(_ input: DeleteSessionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> DeleteSessionResponse {
        try await self.client.execute(
            operation: "DeleteSession", 
            path: "/sessions/{sessionIdentifier}/", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Deletes a session that you ended. You can't delete a session with an ACTIVE status. To delete an active session, you must first end it with the EndSession API operation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    ///
    /// Parameters:
    ///   - sessionIdentifier: The unique identifier for the session to be deleted. You can specify either the session's sessionId or its Amazon Resource Name (ARN).
    ///   - logger: Logger use during operation
    @inlinable
    public func deleteSession(
        sessionIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> DeleteSessionResponse {
        let input = DeleteSessionRequest(
            sessionIdentifier: sessionIdentifier
        )
        return try await self.deleteSession(input, logger: logger)
    }

    /// Ends the session. After you end a session, you can still access its content but you can’t add to it. To delete the session and it's content, you use the DeleteSession API operation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    @Sendable
    @inlinable
    public func endSession(_ input: EndSessionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> EndSessionResponse {
        try await self.client.execute(
            operation: "EndSession", 
            path: "/sessions/{sessionIdentifier}", 
            httpMethod: .PATCH, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Ends the session. After you end a session, you can still access its content but you can’t add to it. To delete the session and it's content, you use the DeleteSession API operation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    ///
    /// Parameters:
    ///   - sessionIdentifier: The unique identifier for the session to end. You can specify either the session's sessionId or its Amazon Resource Name (ARN).
    ///   - logger: Logger use during operation
    @inlinable
    public func endSession(
        sessionIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> EndSessionResponse {
        let input = EndSessionRequest(
            sessionIdentifier: sessionIdentifier
        )
        return try await self.endSession(input, logger: logger)
    }

    /// Generates an SQL query from a natural language query. For more information, see Generate a query for structured data in the Amazon Bedrock User Guide.
    @Sendable
    @inlinable
    public func generateQuery(_ input: GenerateQueryRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GenerateQueryResponse {
        try await self.client.execute(
            operation: "GenerateQuery", 
            path: "/generateQuery", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Generates an SQL query from a natural language query. For more information, see Generate a query for structured data in the Amazon Bedrock User Guide.
    ///
    /// Parameters:
    ///   - queryGenerationInput: Specifies information about a natural language query to transform into SQL.
    ///   - transformationConfiguration: Specifies configurations for transforming the natural language query into SQL.
    ///   - logger: Logger use during operation
    @inlinable
    public func generateQuery(
        queryGenerationInput: QueryGenerationInput,
        transformationConfiguration: TransformationConfiguration,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GenerateQueryResponse {
        let input = GenerateQueryRequest(
            queryGenerationInput: queryGenerationInput, 
            transformationConfiguration: transformationConfiguration
        )
        return try await self.generateQuery(input, logger: logger)
    }

    /// Gets the sessions stored in the memory of the agent.
    @Sendable
    @inlinable
    public func getAgentMemory(_ input: GetAgentMemoryRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetAgentMemoryResponse {
        try await self.client.execute(
            operation: "GetAgentMemory", 
            path: "/agents/{agentId}/agentAliases/{agentAliasId}/memories", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Gets the sessions stored in the memory of the agent.
    ///
    /// Parameters:
    ///   - agentAliasId: The unique identifier of an alias of an agent.
    ///   - agentId: The unique identifier of the agent to which the alias belongs.
    ///   - maxItems: The maximum number of items to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.
    ///   - memoryId: The unique identifier of the memory.
    ///   - memoryType: The type of memory.
    ///   - nextToken: If the total number of results is greater than the maxItems value provided in the request, enter the token returned in the nextToken field in the response in this field to return the next batch of results.
    ///   - logger: Logger use during operation
    @inlinable
    public func getAgentMemory(
        agentAliasId: String,
        agentId: String,
        maxItems: Int? = nil,
        memoryId: String,
        memoryType: MemoryType,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetAgentMemoryResponse {
        let input = GetAgentMemoryRequest(
            agentAliasId: agentAliasId, 
            agentId: agentId, 
            maxItems: maxItems, 
            memoryId: memoryId, 
            memoryType: memoryType, 
            nextToken: nextToken
        )
        return try await self.getAgentMemory(input, logger: logger)
    }

    /// Retrieves the flow definition snapshot used for a flow execution. The snapshot represents the flow metadata and definition as it existed at the time the execution was started. Note that even if the flow is edited after an execution starts, the snapshot connected to the execution remains unchanged.  Flow executions is in preview release for Amazon Bedrock and is subject to change.
    @Sendable
    @inlinable
    public func getExecutionFlowSnapshot(_ input: GetExecutionFlowSnapshotRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetExecutionFlowSnapshotResponse {
        try await self.client.execute(
            operation: "GetExecutionFlowSnapshot", 
            path: "/flows/{flowIdentifier}/aliases/{flowAliasIdentifier}/executions/{executionIdentifier}/flowsnapshot", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves the flow definition snapshot used for a flow execution. The snapshot represents the flow metadata and definition as it existed at the time the execution was started. Note that even if the flow is edited after an execution starts, the snapshot connected to the execution remains unchanged.  Flow executions is in preview release for Amazon Bedrock and is subject to change.
    ///
    /// Parameters:
    ///   - executionIdentifier: The unique identifier of the flow execution.
    ///   - flowAliasIdentifier: The unique identifier of the flow alias used for the flow execution.
    ///   - flowIdentifier: The unique identifier of the flow.
    ///   - logger: Logger use during operation
    @inlinable
    public func getExecutionFlowSnapshot(
        executionIdentifier: String,
        flowAliasIdentifier: String,
        flowIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetExecutionFlowSnapshotResponse {
        let input = GetExecutionFlowSnapshotRequest(
            executionIdentifier: executionIdentifier, 
            flowAliasIdentifier: flowAliasIdentifier, 
            flowIdentifier: flowIdentifier
        )
        return try await self.getExecutionFlowSnapshot(input, logger: logger)
    }

    /// Retrieves details about a specific flow execution, including its status, start and end times, and any errors that occurred during execution.
    @Sendable
    @inlinable
    public func getFlowExecution(_ input: GetFlowExecutionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetFlowExecutionResponse {
        try await self.client.execute(
            operation: "GetFlowExecution", 
            path: "/flows/{flowIdentifier}/aliases/{flowAliasIdentifier}/executions/{executionIdentifier}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves details about a specific flow execution, including its status, start and end times, and any errors that occurred during execution.
    ///
    /// Parameters:
    ///   - executionIdentifier: The unique identifier of the flow execution to retrieve.
    ///   - flowAliasIdentifier: The unique identifier of the flow alias used for the execution.
    ///   - flowIdentifier: The unique identifier of the flow.
    ///   - logger: Logger use during operation
    @inlinable
    public func getFlowExecution(
        executionIdentifier: String,
        flowAliasIdentifier: String,
        flowIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetFlowExecutionResponse {
        let input = GetFlowExecutionRequest(
            executionIdentifier: executionIdentifier, 
            flowAliasIdentifier: flowAliasIdentifier, 
            flowIdentifier: flowIdentifier
        )
        return try await self.getFlowExecution(input, logger: logger)
    }

    /// Retrieves the details of a specific invocation step within an invocation in a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    @Sendable
    @inlinable
    public func getInvocationStep(_ input: GetInvocationStepRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetInvocationStepResponse {
        try await self.client.execute(
            operation: "GetInvocationStep", 
            path: "/sessions/{sessionIdentifier}/invocationSteps/{invocationStepId}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves the details of a specific invocation step within an invocation in a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    ///
    /// Parameters:
    ///   - invocationIdentifier: The unique identifier for the invocation in UUID format.
    ///   - invocationStepId: The unique identifier (in UUID format) for the specific invocation step to retrieve.
    ///   - sessionIdentifier: The unique identifier for the invocation step's associated session. You can specify either the session's sessionId or its Amazon Resource Name (ARN).
    ///   - logger: Logger use during operation
    @inlinable
    public func getInvocationStep(
        invocationIdentifier: String,
        invocationStepId: String,
        sessionIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetInvocationStepResponse {
        let input = GetInvocationStepRequest(
            invocationIdentifier: invocationIdentifier, 
            invocationStepId: invocationStepId, 
            sessionIdentifier: sessionIdentifier
        )
        return try await self.getInvocationStep(input, logger: logger)
    }

    /// Retrieves details about a specific session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    @Sendable
    @inlinable
    public func getSession(_ input: GetSessionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> GetSessionResponse {
        try await self.client.execute(
            operation: "GetSession", 
            path: "/sessions/{sessionIdentifier}/", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Retrieves details about a specific session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    ///
    /// Parameters:
    ///   - sessionIdentifier: A unique identifier for the session to retrieve. You can specify either the session's sessionId or its Amazon Resource Name (ARN).
    ///   - logger: Logger use during operation
    @inlinable
    public func getSession(
        sessionIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> GetSessionResponse {
        let input = GetSessionRequest(
            sessionIdentifier: sessionIdentifier
        )
        return try await self.getSession(input, logger: logger)
    }

    ///   Sends a prompt for the agent to process and respond to. Note the following fields for the request:   To continue the same conversation with an agent, use the same sessionId value in the request.   To activate trace enablement, turn enableTrace to true. Trace enablement helps you follow the agent's reasoning process that led it to the information it processed, the actions it took, and the final result it yielded. For more information, see Trace enablement.   End a conversation by setting endSession to true.   In the sessionState object, you can include attributes for the session or prompt or, if you configured an action group to return control, results from invocation of the action group.   The response contains both chunk and trace attributes. The final response is returned in the bytes field of the chunk object. The InvokeAgent returns one chunk for the entire interaction.   The attribution object contains citations for parts of the response.   If you set enableTrace to true in the request, you can trace the agent's steps and reasoning process that led it to the response.   If the action predicted was configured to return control, the response returns parameters for the action, elicited from the user, in the returnControl field.   Errors are also surfaced in the response.
    @Sendable
    @inlinable
    public func invokeAgent(_ input: InvokeAgentRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> InvokeAgentResponse {
        try await self.client.execute(
            operation: "InvokeAgent", 
            path: "/agents/{agentId}/agentAliases/{agentAliasId}/sessions/{sessionId}/text", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    ///   Sends a prompt for the agent to process and respond to. Note the following fields for the request:   To continue the same conversation with an agent, use the same sessionId value in the request.   To activate trace enablement, turn enableTrace to true. Trace enablement helps you follow the agent's reasoning process that led it to the information it processed, the actions it took, and the final result it yielded. For more information, see Trace enablement.   End a conversation by setting endSession to true.   In the sessionState object, you can include attributes for the session or prompt or, if you configured an action group to return control, results from invocation of the action group.   The response contains both chunk and trace attributes. The final response is returned in the bytes field of the chunk object. The InvokeAgent returns one chunk for the entire interaction.   The attribution object contains citations for parts of the response.   If you set enableTrace to true in the request, you can trace the agent's steps and reasoning process that led it to the response.   If the action predicted was configured to return control, the response returns parameters for the action, elicited from the user, in the returnControl field.   Errors are also surfaced in the response.
    ///
    /// Parameters:
    ///   - agentAliasId: The alias of the agent to use.
    ///   - agentId: The unique identifier of the agent to use.
    ///   - bedrockModelConfigurations: Model performance settings for the request.
    ///   - enableTrace: Specifies whether to turn on the trace or not to track the agent's reasoning process. For more information, see Trace enablement.
    ///   - endSession: Specifies whether to end the session with the agent or not.
    ///   - inputText: The prompt text to send the agent.  If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.
    ///   - memoryId: The unique identifier of the agent memory.
    ///   - promptCreationConfigurations: Specifies parameters that control how the service populates the agent prompt for an InvokeAgent request. You can control which aspects of previous invocations in the same agent session the service uses to populate the agent prompt. This gives you more granular control over the contextual history that is used to process the current request.
    ///   - sessionId: The unique identifier of the session. Use the same value across requests to continue the same conversation.
    ///   - sessionState: Contains parameters that specify various attributes of the session. For more information, see Control session context.  If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.
    ///   - sourceArn: The ARN of the resource making the request.
    ///   - streamingConfigurations:  Specifies the configurations for streaming.   To use agent streaming, you need permissions to perform the bedrock:InvokeModelWithResponseStream action.
    ///   - logger: Logger use during operation
    @inlinable
    public func invokeAgent(
        agentAliasId: String,
        agentId: String,
        bedrockModelConfigurations: BedrockModelConfigurations? = nil,
        enableTrace: Bool? = nil,
        endSession: Bool? = nil,
        inputText: String? = nil,
        memoryId: String? = nil,
        promptCreationConfigurations: PromptCreationConfigurations? = nil,
        sessionId: String,
        sessionState: SessionState? = nil,
        sourceArn: String? = nil,
        streamingConfigurations: StreamingConfigurations? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> InvokeAgentResponse {
        let input = InvokeAgentRequest(
            agentAliasId: agentAliasId, 
            agentId: agentId, 
            bedrockModelConfigurations: bedrockModelConfigurations, 
            enableTrace: enableTrace, 
            endSession: endSession, 
            inputText: inputText, 
            memoryId: memoryId, 
            promptCreationConfigurations: promptCreationConfigurations, 
            sessionId: sessionId, 
            sessionState: sessionState, 
            sourceArn: sourceArn, 
            streamingConfigurations: streamingConfigurations
        )
        return try await self.invokeAgent(input, logger: logger)
    }

    /// Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.  The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeFlow.
    @Sendable
    @inlinable
    public func invokeFlow(_ input: InvokeFlowRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> InvokeFlowResponse {
        try await self.client.execute(
            operation: "InvokeFlow", 
            path: "/flows/{flowIdentifier}/aliases/{flowAliasIdentifier}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream. If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.  The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeFlow.
    ///
    /// Parameters:
    ///   - enableTrace: Specifies whether to return the trace for the flow or not. Traces track inputs and outputs for nodes in the flow. For more information, see Track each step in your prompt flow by viewing its trace in Amazon Bedrock.
    ///   - executionId: The unique identifier for the current flow execution. If you don't provide a value, Amazon Bedrock creates the identifier for you.
    ///   - flowAliasIdentifier: The unique identifier of the flow alias.
    ///   - flowIdentifier: The unique identifier of the flow.
    ///   - inputs: A list of objects, each containing information about an input into the flow.
    ///   - modelPerformanceConfiguration: Model performance settings for the request.
    ///   - logger: Logger use during operation
    @inlinable
    public func invokeFlow(
        enableTrace: Bool? = nil,
        executionId: String? = nil,
        flowAliasIdentifier: String,
        flowIdentifier: String,
        inputs: [FlowInput],
        modelPerformanceConfiguration: ModelPerformanceConfiguration? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> InvokeFlowResponse {
        let input = InvokeFlowRequest(
            enableTrace: enableTrace, 
            executionId: executionId, 
            flowAliasIdentifier: flowAliasIdentifier, 
            flowIdentifier: flowIdentifier, 
            inputs: inputs, 
            modelPerformanceConfiguration: modelPerformanceConfiguration
        )
        return try await self.invokeFlow(input, logger: logger)
    }

    ///  Invokes an inline Amazon Bedrock agent using the configurations you provide with the request.    Specify the following fields for security purposes.   (Optional) customerEncryptionKeyArn – The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent.   (Optional) idleSessionTTLinSeconds – Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequent InvokeInlineAgent request begins a new session.     To override the default prompt behavior for agent orchestration and to use advanced prompts, include a promptOverrideConfiguration object. For more information, see Advanced prompts.   The agent instructions will not be honored if your agent has only one knowledge base, uses default prompts, has no action group, and user input is disabled.
    @Sendable
    @inlinable
    public func invokeInlineAgent(_ input: InvokeInlineAgentRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> InvokeInlineAgentResponse {
        try await self.client.execute(
            operation: "InvokeInlineAgent", 
            path: "/agents/{sessionId}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    ///  Invokes an inline Amazon Bedrock agent using the configurations you provide with the request.    Specify the following fields for security purposes.   (Optional) customerEncryptionKeyArn – The Amazon Resource Name (ARN) of a KMS key to encrypt the creation of the agent.   (Optional) idleSessionTTLinSeconds – Specify the number of seconds for which the agent should maintain session information. After this time expires, the subsequent InvokeInlineAgent request begins a new session.     To override the default prompt behavior for agent orchestration and to use advanced prompts, include a promptOverrideConfiguration object. For more information, see Advanced prompts.   The agent instructions will not be honored if your agent has only one knowledge base, uses default prompts, has no action group, and user input is disabled.
    ///
    /// Parameters:
    ///   - actionGroups:  A list of action groups with each action group defining the action the inline agent needs to carry out.
    ///   - agentCollaboration:  Defines how the inline collaborator agent handles information across multiple collaborator agents to coordinate a final response. The inline collaborator agent can also be the supervisor.
    ///   - agentName: The name for the agent.
    ///   - bedrockModelConfigurations: Model settings for the request.
    ///   - collaboratorConfigurations:  Settings for an inline agent collaborator called with InvokeInlineAgent.
    ///   - collaborators:  List of collaborator inline agents.
    ///   - customerEncryptionKeyArn:  The Amazon Resource Name (ARN) of the Amazon Web Services KMS key to use to encrypt your inline agent.
    ///   - customOrchestration: Contains details of the custom orchestration configured for the agent.
    ///   - enableTrace:  Specifies whether to turn on the trace or not to track the agent's reasoning process. For more information, see Using trace.
    ///   - endSession:  Specifies whether to end the session with the inline agent or not.
    ///   - foundationModel:  The model identifier (ID) of the model to use for orchestration by the inline agent. For example, meta.llama3-1-70b-instruct-v1:0.
    ///   - guardrailConfiguration:  The guardrails to assign to the inline agent.
    ///   - idleSessionTTLInSeconds:  The number of seconds for which the inline agent should maintain session information. After this time expires, the subsequent InvokeInlineAgent request begins a new session.  A user interaction remains active for the amount of time specified. If no conversation occurs during this time, the session expires and the data provided before the timeout is deleted.
    ///   - inlineSessionState:  Parameters that specify the various attributes of a sessions. You can include attributes for the session or prompt or, if you configured an action group to return control, results from invocation of the action group. For more information, see Control session context.   If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.
    ///   - inputText:  The prompt text to send to the agent.   If you include returnControlInvocationResults in the sessionState field, the inputText field will be ignored.
    ///   - instruction:  The instructions that tell the inline agent what it should do and how it should interact with users.
    ///   - knowledgeBases:  Contains information of the knowledge bases to associate with.
    ///   - orchestrationType: Specifies the type of orchestration strategy for the agent. This is set to DEFAULT orchestration type, by default.
    ///   - promptCreationConfigurations: Specifies parameters that control how the service populates the agent prompt for an InvokeInlineAgent request. You can control which aspects of previous invocations in the same agent session the service uses to populate the agent prompt. This gives you more granular control over the contextual history that is used to process the current request.
    ///   - promptOverrideConfiguration:  Configurations for advanced prompts used to override the default prompts to enhance the accuracy of the inline agent.
    ///   - sessionId:  The unique identifier of the session. Use the same value across requests to continue the same conversation.
    ///   - streamingConfigurations:  Specifies the configurations for streaming.   To use agent streaming, you need permissions to perform the bedrock:InvokeModelWithResponseStream action.
    ///   - logger: Logger use during operation
    @inlinable
    public func invokeInlineAgent(
        actionGroups: [AgentActionGroup]? = nil,
        agentCollaboration: AgentCollaboration? = nil,
        agentName: String? = nil,
        bedrockModelConfigurations: InlineBedrockModelConfigurations? = nil,
        collaboratorConfigurations: [CollaboratorConfiguration]? = nil,
        collaborators: [Collaborator]? = nil,
        customerEncryptionKeyArn: String? = nil,
        customOrchestration: CustomOrchestration? = nil,
        enableTrace: Bool? = nil,
        endSession: Bool? = nil,
        foundationModel: String,
        guardrailConfiguration: GuardrailConfigurationWithArn? = nil,
        idleSessionTTLInSeconds: Int? = nil,
        inlineSessionState: InlineSessionState? = nil,
        inputText: String? = nil,
        instruction: String,
        knowledgeBases: [KnowledgeBase]? = nil,
        orchestrationType: OrchestrationType? = nil,
        promptCreationConfigurations: PromptCreationConfigurations? = nil,
        promptOverrideConfiguration: PromptOverrideConfiguration? = nil,
        sessionId: String,
        streamingConfigurations: StreamingConfigurations? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> InvokeInlineAgentResponse {
        let input = InvokeInlineAgentRequest(
            actionGroups: actionGroups, 
            agentCollaboration: agentCollaboration, 
            agentName: agentName, 
            bedrockModelConfigurations: bedrockModelConfigurations, 
            collaboratorConfigurations: collaboratorConfigurations, 
            collaborators: collaborators, 
            customerEncryptionKeyArn: customerEncryptionKeyArn, 
            customOrchestration: customOrchestration, 
            enableTrace: enableTrace, 
            endSession: endSession, 
            foundationModel: foundationModel, 
            guardrailConfiguration: guardrailConfiguration, 
            idleSessionTTLInSeconds: idleSessionTTLInSeconds, 
            inlineSessionState: inlineSessionState, 
            inputText: inputText, 
            instruction: instruction, 
            knowledgeBases: knowledgeBases, 
            orchestrationType: orchestrationType, 
            promptCreationConfigurations: promptCreationConfigurations, 
            promptOverrideConfiguration: promptOverrideConfiguration, 
            sessionId: sessionId, 
            streamingConfigurations: streamingConfigurations
        )
        return try await self.invokeInlineAgent(input, logger: logger)
    }

    /// Lists events that occurred during a flow execution. Events provide detailed information about the execution progress, including node inputs and outputs, flow inputs and outputs, condition results, and failure events.  Flow executions is in preview release for Amazon Bedrock and is subject to change.
    @Sendable
    @inlinable
    public func listFlowExecutionEvents(_ input: ListFlowExecutionEventsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListFlowExecutionEventsResponse {
        try await self.client.execute(
            operation: "ListFlowExecutionEvents", 
            path: "/flows/{flowIdentifier}/aliases/{flowAliasIdentifier}/executions/{executionIdentifier}/events", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Lists events that occurred during a flow execution. Events provide detailed information about the execution progress, including node inputs and outputs, flow inputs and outputs, condition results, and failure events.  Flow executions is in preview release for Amazon Bedrock and is subject to change.
    ///
    /// Parameters:
    ///   - eventType: The type of events to retrieve. Specify Node for node-level events or Flow for flow-level events.
    ///   - executionIdentifier: The unique identifier of the flow execution.
    ///   - flowAliasIdentifier: The unique identifier of the flow alias used for the execution.
    ///   - flowIdentifier: The unique identifier of the flow.
    ///   - maxResults: The maximum number of events to return in a single response. If more events exist than the specified maxResults value, a token is included in the response so that the remaining results can be retrieved.
    ///   - nextToken: A token to retrieve the next set of results. This value is returned in the response if more results are available.
    ///   - logger: Logger use during operation
    @inlinable
    public func listFlowExecutionEvents(
        eventType: FlowExecutionEventType,
        executionIdentifier: String,
        flowAliasIdentifier: String,
        flowIdentifier: String,
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListFlowExecutionEventsResponse {
        let input = ListFlowExecutionEventsRequest(
            eventType: eventType, 
            executionIdentifier: executionIdentifier, 
            flowAliasIdentifier: flowAliasIdentifier, 
            flowIdentifier: flowIdentifier, 
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listFlowExecutionEvents(input, logger: logger)
    }

    /// Lists all executions of a flow. Results can be paginated and include summary information about each execution, such as status, start and end times, and the execution's Amazon Resource Name (ARN).  Flow executions is in preview release for Amazon Bedrock and is subject to change.
    @Sendable
    @inlinable
    public func listFlowExecutions(_ input: ListFlowExecutionsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListFlowExecutionsResponse {
        try await self.client.execute(
            operation: "ListFlowExecutions", 
            path: "/flows/{flowIdentifier}/executions", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Lists all executions of a flow. Results can be paginated and include summary information about each execution, such as status, start and end times, and the execution's Amazon Resource Name (ARN).  Flow executions is in preview release for Amazon Bedrock and is subject to change.
    ///
    /// Parameters:
    ///   - flowAliasIdentifier: The unique identifier of the flow alias to list executions for.
    ///   - flowIdentifier: The unique identifier of the flow to list executions for.
    ///   - maxResults: The maximum number of flow executions to return in a single response. If more executions exist than the specified maxResults value, a token is included in the response so that the remaining results can be retrieved.
    ///   - nextToken: A token to retrieve the next set of results. This value is returned in the response if more results are available.
    ///   - logger: Logger use during operation
    @inlinable
    public func listFlowExecutions(
        flowAliasIdentifier: String? = nil,
        flowIdentifier: String,
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListFlowExecutionsResponse {
        let input = ListFlowExecutionsRequest(
            flowAliasIdentifier: flowAliasIdentifier, 
            flowIdentifier: flowIdentifier, 
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listFlowExecutions(input, logger: logger)
    }

    /// Lists all invocation steps associated with a session and optionally, an invocation within the session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    @Sendable
    @inlinable
    public func listInvocationSteps(_ input: ListInvocationStepsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListInvocationStepsResponse {
        try await self.client.execute(
            operation: "ListInvocationSteps", 
            path: "/sessions/{sessionIdentifier}/invocationSteps/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Lists all invocation steps associated with a session and optionally, an invocation within the session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    ///
    /// Parameters:
    ///   - invocationIdentifier: The unique identifier (in UUID format) for the invocation to list invocation steps for.
    ///   - maxResults: The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.
    ///   - nextToken: If the total number of results is greater than the maxResults value provided in the request, enter the token returned in the nextToken field in the response in this field to return the next batch of results.
    ///   - sessionIdentifier: The unique identifier for the session associated with the invocation steps. You can specify either the session's sessionId or its Amazon Resource Name (ARN).
    ///   - logger: Logger use during operation
    @inlinable
    public func listInvocationSteps(
        invocationIdentifier: String? = nil,
        maxResults: Int? = nil,
        nextToken: String? = nil,
        sessionIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListInvocationStepsResponse {
        let input = ListInvocationStepsRequest(
            invocationIdentifier: invocationIdentifier, 
            maxResults: maxResults, 
            nextToken: nextToken, 
            sessionIdentifier: sessionIdentifier
        )
        return try await self.listInvocationSteps(input, logger: logger)
    }

    /// Lists all invocations associated with a specific session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    @Sendable
    @inlinable
    public func listInvocations(_ input: ListInvocationsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListInvocationsResponse {
        try await self.client.execute(
            operation: "ListInvocations", 
            path: "/sessions/{sessionIdentifier}/invocations/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Lists all invocations associated with a specific session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.
    ///   - nextToken: If the total number of results is greater than the maxResults value provided in the request, enter the token returned in the nextToken field in the response in this field to return the next batch of results.
    ///   - sessionIdentifier: The unique identifier for the session to list invocations for. You can specify either the session's sessionId or its Amazon Resource Name (ARN).
    ///   - logger: Logger use during operation
    @inlinable
    public func listInvocations(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        sessionIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListInvocationsResponse {
        let input = ListInvocationsRequest(
            maxResults: maxResults, 
            nextToken: nextToken, 
            sessionIdentifier: sessionIdentifier
        )
        return try await self.listInvocations(input, logger: logger)
    }

    /// Lists all sessions in your Amazon Web Services account. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    @Sendable
    @inlinable
    public func listSessions(_ input: ListSessionsRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListSessionsResponse {
        try await self.client.execute(
            operation: "ListSessions", 
            path: "/sessions/", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Lists all sessions in your Amazon Web Services account. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    ///
    /// Parameters:
    ///   - maxResults: The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.
    ///   - nextToken: If the total number of results is greater than the maxResults value provided in the request, enter the token returned in the nextToken field in the response in this field to return the next batch of results.
    ///   - logger: Logger use during operation
    @inlinable
    public func listSessions(
        maxResults: Int? = nil,
        nextToken: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListSessionsResponse {
        let input = ListSessionsRequest(
            maxResults: maxResults, 
            nextToken: nextToken
        )
        return try await self.listSessions(input, logger: logger)
    }

    /// List all the tags for the resource you specify.
    @Sendable
    @inlinable
    public func listTagsForResource(_ input: ListTagsForResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> ListTagsForResourceResponse {
        try await self.client.execute(
            operation: "ListTagsForResource", 
            path: "/tags/{resourceArn}", 
            httpMethod: .GET, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// List all the tags for the resource you specify.
    ///
    /// Parameters:
    ///   - resourceArn: The Amazon Resource Name (ARN) of the resource for which to list tags.
    ///   - logger: Logger use during operation
    @inlinable
    public func listTagsForResource(
        resourceArn: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> ListTagsForResourceResponse {
        let input = ListTagsForResourceRequest(
            resourceArn: resourceArn
        )
        return try await self.listTagsForResource(input, logger: logger)
    }

    /// Optimizes a prompt for the task that you specify. For more information, see Optimize a prompt in the Amazon Bedrock User Guide.
    @Sendable
    @inlinable
    public func optimizePrompt(_ input: OptimizePromptRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> OptimizePromptResponse {
        try await self.client.execute(
            operation: "OptimizePrompt", 
            path: "/optimize-prompt", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Optimizes a prompt for the task that you specify. For more information, see Optimize a prompt in the Amazon Bedrock User Guide.
    ///
    /// Parameters:
    ///   - input: Contains the prompt to optimize.
    ///   - targetModelId: The unique identifier of the model that you want to optimize the prompt for.
    ///   - logger: Logger use during operation
    @inlinable
    public func optimizePrompt(
        input: InputPrompt,
        targetModelId: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> OptimizePromptResponse {
        let input = OptimizePromptRequest(
            input: input, 
            targetModelId: targetModelId
        )
        return try await self.optimizePrompt(input, logger: logger)
    }

    /// Add an invocation step to an invocation in a session. An invocation step stores fine-grained state checkpoints, including text and images, for each interaction. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. Related APIs:    GetInvocationStep     ListInvocationSteps     ListInvocations     ListSessions
    @Sendable
    @inlinable
    public func putInvocationStep(_ input: PutInvocationStepRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> PutInvocationStepResponse {
        try await self.client.execute(
            operation: "PutInvocationStep", 
            path: "/sessions/{sessionIdentifier}/invocationSteps/", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Add an invocation step to an invocation in a session. An invocation step stores fine-grained state checkpoints, including text and images, for each interaction. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions. Related APIs:    GetInvocationStep     ListInvocationSteps     ListInvocations     ListSessions
    ///
    /// Parameters:
    ///   - invocationIdentifier: The unique identifier (in UUID format) of the invocation to add the invocation step to.
    ///   - invocationStepId: The unique identifier of the invocation step in UUID format.
    ///   - invocationStepTime: The timestamp for when the invocation step occurred.
    ///   - payload: The payload for the invocation step, including text and images for the interaction.
    ///   - sessionIdentifier: The unique identifier for the session to add the invocation step to. You can specify either the session's sessionId or its Amazon Resource Name (ARN).
    ///   - logger: Logger use during operation
    @inlinable
    public func putInvocationStep(
        invocationIdentifier: String,
        invocationStepId: String? = nil,
        invocationStepTime: Date,
        payload: InvocationStepPayload,
        sessionIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> PutInvocationStepResponse {
        let input = PutInvocationStepRequest(
            invocationIdentifier: invocationIdentifier, 
            invocationStepId: invocationStepId, 
            invocationStepTime: invocationStepTime, 
            payload: payload, 
            sessionIdentifier: sessionIdentifier
        )
        return try await self.putInvocationStep(input, logger: logger)
    }

    /// Reranks the relevance of sources based on queries. For more information, see Improve the relevance of query responses with a reranker model.
    @Sendable
    @inlinable
    public func rerank(_ input: RerankRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> RerankResponse {
        try await self.client.execute(
            operation: "Rerank", 
            path: "/rerank", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Reranks the relevance of sources based on queries. For more information, see Improve the relevance of query responses with a reranker model.
    ///
    /// Parameters:
    ///   - nextToken: If the total number of results was greater than could fit in a response, a token is returned in the nextToken field. You can enter that token in this field to return the next batch of results.
    ///   - queries: An array of objects, each of which contains information about a query to submit to the reranker model.
    ///   - rerankingConfiguration: Contains configurations for reranking.
    ///   - sources: An array of objects, each of which contains information about the sources to rerank.
    ///   - logger: Logger use during operation
    @inlinable
    public func rerank(
        nextToken: String? = nil,
        queries: [RerankQuery],
        rerankingConfiguration: RerankingConfiguration,
        sources: [RerankSource],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> RerankResponse {
        let input = RerankRequest(
            nextToken: nextToken, 
            queries: queries, 
            rerankingConfiguration: rerankingConfiguration, 
            sources: sources
        )
        return try await self.rerank(input, logger: logger)
    }

    /// Queries a knowledge base and retrieves information from it.
    @Sendable
    @inlinable
    public func retrieve(_ input: RetrieveRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> RetrieveResponse {
        try await self.client.execute(
            operation: "Retrieve", 
            path: "/knowledgebases/{knowledgeBaseId}/retrieve", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Queries a knowledge base and retrieves information from it.
    ///
    /// Parameters:
    ///   - guardrailConfiguration: Guardrail settings.
    ///   - knowledgeBaseId: The unique identifier of the knowledge base to query.
    ///   - nextToken: If there are more results than can fit in the response, the response returns a nextToken. Use this token in the nextToken field of another request to retrieve the next batch of results.
    ///   - retrievalConfiguration: Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations.
    ///   - retrievalQuery: Contains the query to send the knowledge base.
    ///   - logger: Logger use during operation
    @inlinable
    public func retrieve(
        guardrailConfiguration: GuardrailConfiguration? = nil,
        knowledgeBaseId: String,
        nextToken: String? = nil,
        retrievalConfiguration: KnowledgeBaseRetrievalConfiguration? = nil,
        retrievalQuery: KnowledgeBaseQuery,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> RetrieveResponse {
        let input = RetrieveRequest(
            guardrailConfiguration: guardrailConfiguration, 
            knowledgeBaseId: knowledgeBaseId, 
            nextToken: nextToken, 
            retrievalConfiguration: retrievalConfiguration, 
            retrievalQuery: retrievalQuery
        )
        return try await self.retrieve(input, logger: logger)
    }

    /// Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile. The response only cites sources that are relevant to the query.
    @Sendable
    @inlinable
    public func retrieveAndGenerate(_ input: RetrieveAndGenerateRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> RetrieveAndGenerateResponse {
        try await self.client.execute(
            operation: "RetrieveAndGenerate", 
            path: "/retrieveAndGenerate", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile. The response only cites sources that are relevant to the query.
    ///
    /// Parameters:
    ///   - input: Contains the query to be made to the knowledge base.
    ///   - retrieveAndGenerateConfiguration: Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations.
    ///   - sessionConfiguration: Contains details about the session with the knowledge base.
    ///   - sessionId: The unique identifier of the session. When you first make a RetrieveAndGenerate request, Amazon Bedrock automatically generates this value. You must reuse this value for all subsequent requests in the same conversational session. This value allows Amazon Bedrock to maintain context and knowledge from previous interactions. You can't explicitly set the sessionId yourself.
    ///   - logger: Logger use during operation
    @inlinable
    public func retrieveAndGenerate(
        input: RetrieveAndGenerateInput,
        retrieveAndGenerateConfiguration: RetrieveAndGenerateConfiguration? = nil,
        sessionConfiguration: RetrieveAndGenerateSessionConfiguration? = nil,
        sessionId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> RetrieveAndGenerateResponse {
        let input = RetrieveAndGenerateRequest(
            input: input, 
            retrieveAndGenerateConfiguration: retrieveAndGenerateConfiguration, 
            sessionConfiguration: sessionConfiguration, 
            sessionId: sessionId
        )
        return try await self.retrieveAndGenerate(input, logger: logger)
    }

    /// Queries a knowledge base and generates responses based on the retrieved results, with output in streaming format.  The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeModelWithResponseStream.  This operation requires permission for the  bedrock:RetrieveAndGenerate action.
    @Sendable
    @inlinable
    public func retrieveAndGenerateStream(_ input: RetrieveAndGenerateStreamRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> RetrieveAndGenerateStreamResponse {
        try await self.client.execute(
            operation: "RetrieveAndGenerateStream", 
            path: "/retrieveAndGenerateStream", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Queries a knowledge base and generates responses based on the retrieved results, with output in streaming format.  The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeModelWithResponseStream.  This operation requires permission for the  bedrock:RetrieveAndGenerate action.
    ///
    /// Parameters:
    ///   - input: Contains the query to be made to the knowledge base.
    ///   - retrieveAndGenerateConfiguration: Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations.
    ///   - sessionConfiguration: Contains details about the session with the knowledge base.
    ///   - sessionId: The unique identifier of the session. When you first make a RetrieveAndGenerate request, Amazon Bedrock automatically generates this value. You must reuse this value for all subsequent requests in the same conversational session. This value allows Amazon Bedrock to maintain context and knowledge from previous interactions. You can't explicitly set the sessionId yourself.
    ///   - logger: Logger use during operation
    @inlinable
    public func retrieveAndGenerateStream(
        input: RetrieveAndGenerateInput,
        retrieveAndGenerateConfiguration: RetrieveAndGenerateConfiguration? = nil,
        sessionConfiguration: RetrieveAndGenerateSessionConfiguration? = nil,
        sessionId: String? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> RetrieveAndGenerateStreamResponse {
        let input = RetrieveAndGenerateStreamRequest(
            input: input, 
            retrieveAndGenerateConfiguration: retrieveAndGenerateConfiguration, 
            sessionConfiguration: sessionConfiguration, 
            sessionId: sessionId
        )
        return try await self.retrieveAndGenerateStream(input, logger: logger)
    }

    /// Starts an execution of an Amazon Bedrock flow. Unlike flows that run until completion or time out after five minutes, flow executions let you run flows asynchronously for longer durations. Flow executions also yield control so that your application can perform other tasks. This operation returns an Amazon Resource Name (ARN) that you can use to track and manage your flow execution.  Flow executions is in preview release for Amazon Bedrock and is subject to change.
    @Sendable
    @inlinable
    public func startFlowExecution(_ input: StartFlowExecutionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> StartFlowExecutionResponse {
        try await self.client.execute(
            operation: "StartFlowExecution", 
            path: "/flows/{flowIdentifier}/aliases/{flowAliasIdentifier}/executions", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Starts an execution of an Amazon Bedrock flow. Unlike flows that run until completion or time out after five minutes, flow executions let you run flows asynchronously for longer durations. Flow executions also yield control so that your application can perform other tasks. This operation returns an Amazon Resource Name (ARN) that you can use to track and manage your flow execution.  Flow executions is in preview release for Amazon Bedrock and is subject to change.
    ///
    /// Parameters:
    ///   - flowAliasIdentifier: The unique identifier of the flow alias to use for the flow execution.
    ///   - flowExecutionName: The unique name for the flow execution. If you don't provide one, a system-generated name is used.
    ///   - flowIdentifier: The unique identifier of the flow to execute.
    ///   - inputs: The input data required for the flow execution. This must match the input schema defined in the flow.
    ///   - modelPerformanceConfiguration: The performance settings for the foundation model used in the flow execution.
    ///   - logger: Logger use during operation
    @inlinable
    public func startFlowExecution(
        flowAliasIdentifier: String,
        flowExecutionName: String? = nil,
        flowIdentifier: String,
        inputs: [FlowInput],
        modelPerformanceConfiguration: ModelPerformanceConfiguration? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> StartFlowExecutionResponse {
        let input = StartFlowExecutionRequest(
            flowAliasIdentifier: flowAliasIdentifier, 
            flowExecutionName: flowExecutionName, 
            flowIdentifier: flowIdentifier, 
            inputs: inputs, 
            modelPerformanceConfiguration: modelPerformanceConfiguration
        )
        return try await self.startFlowExecution(input, logger: logger)
    }

    /// Stops an Amazon Bedrock flow's execution. This operation prevents further processing of the flow and changes the execution status to Aborted.
    @Sendable
    @inlinable
    public func stopFlowExecution(_ input: StopFlowExecutionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> StopFlowExecutionResponse {
        try await self.client.execute(
            operation: "StopFlowExecution", 
            path: "/flows/{flowIdentifier}/aliases/{flowAliasIdentifier}/executions/{executionIdentifier}/stop", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Stops an Amazon Bedrock flow's execution. This operation prevents further processing of the flow and changes the execution status to Aborted.
    ///
    /// Parameters:
    ///   - executionIdentifier: The unique identifier of the flow execution to stop.
    ///   - flowAliasIdentifier: The unique identifier of the flow alias used for the execution.
    ///   - flowIdentifier: The unique identifier of the flow.
    ///   - logger: Logger use during operation
    @inlinable
    public func stopFlowExecution(
        executionIdentifier: String,
        flowAliasIdentifier: String,
        flowIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> StopFlowExecutionResponse {
        let input = StopFlowExecutionRequest(
            executionIdentifier: executionIdentifier, 
            flowAliasIdentifier: flowAliasIdentifier, 
            flowIdentifier: flowIdentifier
        )
        return try await self.stopFlowExecution(input, logger: logger)
    }

    /// Associate tags with a resource. For more information, see Tagging resources in the Amazon Bedrock User Guide.
    @Sendable
    @inlinable
    public func tagResource(_ input: TagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> TagResourceResponse {
        try await self.client.execute(
            operation: "TagResource", 
            path: "/tags/{resourceArn}", 
            httpMethod: .POST, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Associate tags with a resource. For more information, see Tagging resources in the Amazon Bedrock User Guide.
    ///
    /// Parameters:
    ///   - resourceArn: The Amazon Resource Name (ARN) of the resource to tag.
    ///   - tags: An object containing key-value pairs that define the tags to attach to the resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func tagResource(
        resourceArn: String,
        tags: [String: String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> TagResourceResponse {
        let input = TagResourceRequest(
            resourceArn: resourceArn, 
            tags: tags
        )
        return try await self.tagResource(input, logger: logger)
    }

    /// Remove tags from a resource.
    @Sendable
    @inlinable
    public func untagResource(_ input: UntagResourceRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UntagResourceResponse {
        try await self.client.execute(
            operation: "UntagResource", 
            path: "/tags/{resourceArn}", 
            httpMethod: .DELETE, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Remove tags from a resource.
    ///
    /// Parameters:
    ///   - resourceArn: The Amazon Resource Name (ARN) of the resource from which to remove tags.
    ///   - tagKeys: A list of keys of the tags to remove from the resource.
    ///   - logger: Logger use during operation
    @inlinable
    public func untagResource(
        resourceArn: String,
        tagKeys: [String],
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UntagResourceResponse {
        let input = UntagResourceRequest(
            resourceArn: resourceArn, 
            tagKeys: tagKeys
        )
        return try await self.untagResource(input, logger: logger)
    }

    /// Updates the metadata or encryption settings of a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    @Sendable
    @inlinable
    public func updateSession(_ input: UpdateSessionRequest, logger: Logger = AWSClient.loggingDisabled) async throws -> UpdateSessionResponse {
        try await self.client.execute(
            operation: "UpdateSession", 
            path: "/sessions/{sessionIdentifier}/", 
            httpMethod: .PUT, 
            serviceConfig: self.config, 
            input: input, 
            logger: logger
        )
    }
    /// Updates the metadata or encryption settings of a session. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
    ///
    /// Parameters:
    ///   - sessionIdentifier: The unique identifier of the session to modify. You can specify either the session's sessionId or its Amazon Resource Name (ARN).
    ///   - sessionMetadata: A map of key-value pairs containing attributes to be persisted across the session. For example the user's ID, their language preference, and the type of device they are using.
    ///   - logger: Logger use during operation
    @inlinable
    public func updateSession(
        sessionIdentifier: String,
        sessionMetadata: [String: String]? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) async throws -> UpdateSessionResponse {
        let input = UpdateSessionRequest(
            sessionIdentifier: sessionIdentifier, 
            sessionMetadata: sessionMetadata
        )
        return try await self.updateSession(input, logger: logger)
    }
}

extension BedrockAgentRuntime {
    /// Initializer required by `AWSService.with(middlewares:timeout:byteBufferAllocator:options)`. You are not able to use this initializer directly as there are not public
    /// initializers for `AWSServiceConfig.Patch`. Please use `AWSService.with(middlewares:timeout:byteBufferAllocator:options)` instead.
    public init(from: BedrockAgentRuntime, patch: AWSServiceConfig.Patch) {
        self.client = from.client
        self.config = from.config.with(patch: patch)
    }
}

// MARK: Paginators

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
extension BedrockAgentRuntime {
    /// Return PaginatorSequence for operation ``getAgentMemory(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func getAgentMemoryPaginator(
        _ input: GetAgentMemoryRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<GetAgentMemoryRequest, GetAgentMemoryResponse> {
        return .init(
            input: input,
            command: self.getAgentMemory,
            inputKey: \GetAgentMemoryRequest.nextToken,
            outputKey: \GetAgentMemoryResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``getAgentMemory(_:logger:)``.
    ///
    /// - Parameters:
    ///   - agentAliasId: The unique identifier of an alias of an agent.
    ///   - agentId: The unique identifier of the agent to which the alias belongs.
    ///   - maxItems: The maximum number of items to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.
    ///   - memoryId: The unique identifier of the memory.
    ///   - memoryType: The type of memory.
    ///   - logger: Logger used for logging
    @inlinable
    public func getAgentMemoryPaginator(
        agentAliasId: String,
        agentId: String,
        maxItems: Int? = nil,
        memoryId: String,
        memoryType: MemoryType,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<GetAgentMemoryRequest, GetAgentMemoryResponse> {
        let input = GetAgentMemoryRequest(
            agentAliasId: agentAliasId, 
            agentId: agentId, 
            maxItems: maxItems, 
            memoryId: memoryId, 
            memoryType: memoryType
        )
        return self.getAgentMemoryPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listFlowExecutionEvents(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listFlowExecutionEventsPaginator(
        _ input: ListFlowExecutionEventsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListFlowExecutionEventsRequest, ListFlowExecutionEventsResponse> {
        return .init(
            input: input,
            command: self.listFlowExecutionEvents,
            inputKey: \ListFlowExecutionEventsRequest.nextToken,
            outputKey: \ListFlowExecutionEventsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listFlowExecutionEvents(_:logger:)``.
    ///
    /// - Parameters:
    ///   - eventType: The type of events to retrieve. Specify Node for node-level events or Flow for flow-level events.
    ///   - executionIdentifier: The unique identifier of the flow execution.
    ///   - flowAliasIdentifier: The unique identifier of the flow alias used for the execution.
    ///   - flowIdentifier: The unique identifier of the flow.
    ///   - maxResults: The maximum number of events to return in a single response. If more events exist than the specified maxResults value, a token is included in the response so that the remaining results can be retrieved.
    ///   - logger: Logger used for logging
    @inlinable
    public func listFlowExecutionEventsPaginator(
        eventType: FlowExecutionEventType,
        executionIdentifier: String,
        flowAliasIdentifier: String,
        flowIdentifier: String,
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListFlowExecutionEventsRequest, ListFlowExecutionEventsResponse> {
        let input = ListFlowExecutionEventsRequest(
            eventType: eventType, 
            executionIdentifier: executionIdentifier, 
            flowAliasIdentifier: flowAliasIdentifier, 
            flowIdentifier: flowIdentifier, 
            maxResults: maxResults
        )
        return self.listFlowExecutionEventsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listFlowExecutions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listFlowExecutionsPaginator(
        _ input: ListFlowExecutionsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListFlowExecutionsRequest, ListFlowExecutionsResponse> {
        return .init(
            input: input,
            command: self.listFlowExecutions,
            inputKey: \ListFlowExecutionsRequest.nextToken,
            outputKey: \ListFlowExecutionsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listFlowExecutions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - flowAliasIdentifier: The unique identifier of the flow alias to list executions for.
    ///   - flowIdentifier: The unique identifier of the flow to list executions for.
    ///   - maxResults: The maximum number of flow executions to return in a single response. If more executions exist than the specified maxResults value, a token is included in the response so that the remaining results can be retrieved.
    ///   - logger: Logger used for logging
    @inlinable
    public func listFlowExecutionsPaginator(
        flowAliasIdentifier: String? = nil,
        flowIdentifier: String,
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListFlowExecutionsRequest, ListFlowExecutionsResponse> {
        let input = ListFlowExecutionsRequest(
            flowAliasIdentifier: flowAliasIdentifier, 
            flowIdentifier: flowIdentifier, 
            maxResults: maxResults
        )
        return self.listFlowExecutionsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listInvocationSteps(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listInvocationStepsPaginator(
        _ input: ListInvocationStepsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListInvocationStepsRequest, ListInvocationStepsResponse> {
        return .init(
            input: input,
            command: self.listInvocationSteps,
            inputKey: \ListInvocationStepsRequest.nextToken,
            outputKey: \ListInvocationStepsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listInvocationSteps(_:logger:)``.
    ///
    /// - Parameters:
    ///   - invocationIdentifier: The unique identifier (in UUID format) for the invocation to list invocation steps for.
    ///   - maxResults: The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.
    ///   - sessionIdentifier: The unique identifier for the session associated with the invocation steps. You can specify either the session's sessionId or its Amazon Resource Name (ARN).
    ///   - logger: Logger used for logging
    @inlinable
    public func listInvocationStepsPaginator(
        invocationIdentifier: String? = nil,
        maxResults: Int? = nil,
        sessionIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListInvocationStepsRequest, ListInvocationStepsResponse> {
        let input = ListInvocationStepsRequest(
            invocationIdentifier: invocationIdentifier, 
            maxResults: maxResults, 
            sessionIdentifier: sessionIdentifier
        )
        return self.listInvocationStepsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listInvocations(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listInvocationsPaginator(
        _ input: ListInvocationsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListInvocationsRequest, ListInvocationsResponse> {
        return .init(
            input: input,
            command: self.listInvocations,
            inputKey: \ListInvocationsRequest.nextToken,
            outputKey: \ListInvocationsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listInvocations(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.
    ///   - sessionIdentifier: The unique identifier for the session to list invocations for. You can specify either the session's sessionId or its Amazon Resource Name (ARN).
    ///   - logger: Logger used for logging
    @inlinable
    public func listInvocationsPaginator(
        maxResults: Int? = nil,
        sessionIdentifier: String,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListInvocationsRequest, ListInvocationsResponse> {
        let input = ListInvocationsRequest(
            maxResults: maxResults, 
            sessionIdentifier: sessionIdentifier
        )
        return self.listInvocationsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``listSessions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func listSessionsPaginator(
        _ input: ListSessionsRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<ListSessionsRequest, ListSessionsResponse> {
        return .init(
            input: input,
            command: self.listSessions,
            inputKey: \ListSessionsRequest.nextToken,
            outputKey: \ListSessionsResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``listSessions(_:logger:)``.
    ///
    /// - Parameters:
    ///   - maxResults: The maximum number of results to return in the response. If the total number of results is greater than this value, use the token returned in the response in the nextToken field when making another request to return the next batch of results.
    ///   - logger: Logger used for logging
    @inlinable
    public func listSessionsPaginator(
        maxResults: Int? = nil,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<ListSessionsRequest, ListSessionsResponse> {
        let input = ListSessionsRequest(
            maxResults: maxResults
        )
        return self.listSessionsPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``rerank(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func rerankPaginator(
        _ input: RerankRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<RerankRequest, RerankResponse> {
        return .init(
            input: input,
            command: self.rerank,
            inputKey: \RerankRequest.nextToken,
            outputKey: \RerankResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``rerank(_:logger:)``.
    ///
    /// - Parameters:
    ///   - queries: An array of objects, each of which contains information about a query to submit to the reranker model.
    ///   - rerankingConfiguration: Contains configurations for reranking.
    ///   - sources: An array of objects, each of which contains information about the sources to rerank.
    ///   - logger: Logger used for logging
    @inlinable
    public func rerankPaginator(
        queries: [RerankQuery],
        rerankingConfiguration: RerankingConfiguration,
        sources: [RerankSource],
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<RerankRequest, RerankResponse> {
        let input = RerankRequest(
            queries: queries, 
            rerankingConfiguration: rerankingConfiguration, 
            sources: sources
        )
        return self.rerankPaginator(input, logger: logger)
    }

    /// Return PaginatorSequence for operation ``retrieve(_:logger:)``.
    ///
    /// - Parameters:
    ///   - input: Input for operation
    ///   - logger: Logger used for logging
    @inlinable
    public func retrievePaginator(
        _ input: RetrieveRequest,
        logger: Logger = AWSClient.loggingDisabled
    ) -> AWSClient.PaginatorSequence<RetrieveRequest, RetrieveResponse> {
        return .init(
            input: input,
            command: self.retrieve,
            inputKey: \RetrieveRequest.nextToken,
            outputKey: \RetrieveResponse.nextToken,
            logger: logger
        )
    }
    /// Return PaginatorSequence for operation ``retrieve(_:logger:)``.
    ///
    /// - Parameters:
    ///   - guardrailConfiguration: Guardrail settings.
    ///   - knowledgeBaseId: The unique identifier of the knowledge base to query.
    ///   - retrievalConfiguration: Contains configurations for the knowledge base query and retrieval process. For more information, see Query configurations.
    ///   - retrievalQuery: Contains the query to send the knowledge base.
    ///   - logger: Logger used for logging
    @inlinable
    public func retrievePaginator(
        guardrailConfiguration: GuardrailConfiguration? = nil,
        knowledgeBaseId: String,
        retrievalConfiguration: KnowledgeBaseRetrievalConfiguration? = nil,
        retrievalQuery: KnowledgeBaseQuery,
        logger: Logger = AWSClient.loggingDisabled        
    ) -> AWSClient.PaginatorSequence<RetrieveRequest, RetrieveResponse> {
        let input = RetrieveRequest(
            guardrailConfiguration: guardrailConfiguration, 
            knowledgeBaseId: knowledgeBaseId, 
            retrievalConfiguration: retrievalConfiguration, 
            retrievalQuery: retrievalQuery
        )
        return self.retrievePaginator(input, logger: logger)
    }
}

extension BedrockAgentRuntime.GetAgentMemoryRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> BedrockAgentRuntime.GetAgentMemoryRequest {
        return .init(
            agentAliasId: self.agentAliasId,
            agentId: self.agentId,
            maxItems: self.maxItems,
            memoryId: self.memoryId,
            memoryType: self.memoryType,
            nextToken: token
        )
    }
}

extension BedrockAgentRuntime.ListFlowExecutionEventsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> BedrockAgentRuntime.ListFlowExecutionEventsRequest {
        return .init(
            eventType: self.eventType,
            executionIdentifier: self.executionIdentifier,
            flowAliasIdentifier: self.flowAliasIdentifier,
            flowIdentifier: self.flowIdentifier,
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension BedrockAgentRuntime.ListFlowExecutionsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> BedrockAgentRuntime.ListFlowExecutionsRequest {
        return .init(
            flowAliasIdentifier: self.flowAliasIdentifier,
            flowIdentifier: self.flowIdentifier,
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension BedrockAgentRuntime.ListInvocationStepsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> BedrockAgentRuntime.ListInvocationStepsRequest {
        return .init(
            invocationIdentifier: self.invocationIdentifier,
            maxResults: self.maxResults,
            nextToken: token,
            sessionIdentifier: self.sessionIdentifier
        )
    }
}

extension BedrockAgentRuntime.ListInvocationsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> BedrockAgentRuntime.ListInvocationsRequest {
        return .init(
            maxResults: self.maxResults,
            nextToken: token,
            sessionIdentifier: self.sessionIdentifier
        )
    }
}

extension BedrockAgentRuntime.ListSessionsRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> BedrockAgentRuntime.ListSessionsRequest {
        return .init(
            maxResults: self.maxResults,
            nextToken: token
        )
    }
}

extension BedrockAgentRuntime.RerankRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> BedrockAgentRuntime.RerankRequest {
        return .init(
            nextToken: token,
            queries: self.queries,
            rerankingConfiguration: self.rerankingConfiguration,
            sources: self.sources
        )
    }
}

extension BedrockAgentRuntime.RetrieveRequest: AWSPaginateToken {
    @inlinable
    public func usingPaginationToken(_ token: String) -> BedrockAgentRuntime.RetrieveRequest {
        return .init(
            guardrailConfiguration: self.guardrailConfiguration,
            knowledgeBaseId: self.knowledgeBaseId,
            nextToken: token,
            retrievalConfiguration: self.retrievalConfiguration,
            retrievalQuery: self.retrievalQuery
        )
    }
}
